home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS04.ADF
/
image.ed
/
modmenu.c
< prev
next >
Wrap
C/C++ Source or Header
|
1985-10-26
|
19KB
|
583 lines
/************* mod.menu.c ****************/
#include "intuall.h"
#include "imageedit.h"
struct Menu menu[6]; /* two major menu items present */
struct MenuItem choiceitem[9];
struct MenuItem choiceitem2[9];
struct IntuiText choicetext[9];
struct MenuItem diskitem[2];
struct IntuiText disktext[2];
struct IntuiText directtext[5]; /* text to use for move */
struct IntuiText movereqtext[2];
struct MenuItem copyitem[4];
struct MenuItem moveitem[3];
struct MenuItem textitem[2];
struct MenuItem miscitem[5];
struct IntuiText copytext[4];
struct IntuiText movetext[3];
struct IntuiText texttext[2];
struct IntuiText misctext[5];
struct MenuItem jamitem[2];
struct MenuItem topazitem[2];
struct IntuiText jamtext[2];
struct IntuiText topaztext[2];
extern struct MenuItem coloritem[];
struct TextAttr TestFont =
{
"topaz.font",
TXHEIGHT,
0,
0,
};
struct Gadget DoneGadget = {
NULL, /* address of next gadget */
12,50,40,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* flags */
RELVERIFY | GADGIMMEDIATE | ENDGADGET,
/* tell me only when he releases the
* mouse button and if over the
* gadget at that time */
REQGADGET | BOOLGADGET, /* is a requestor, boolean */
NULL, /* BORDER descriptor */
NULL, /* SELECT descriptor */
&directtext[4],
0, /* mutual exclusion (could use) */
NULL, /* special info */
4, /* gadget identifier, user */
NULL }; /* user data pointer */
struct Gadget DownGadget = {
&DoneGadget, /* address of next gadget */
40,36,40,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* Flags */
RELVERIFY | GADGIMMEDIATE, /* Activation flags */
REQGADGET | BOOLGADGET, /* is a requestor, boolean */
NULL, /* BORDER descriptor */
NULL, /* SELECT descriptor */
&directtext[3], /* intiutext to write there */
0, /* mutual exclusion (could use) */
NULL, /* special info */
3, /* gadget identifier, user */
NULL }; /* user data pointer */
struct Gadget UpGadget = {
&DownGadget, /* address of next gadget */
48,14,20,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* Flags, rel. to upperleft (normal) */
RELVERIFY | GADGIMMEDIATE, /* Activation flags */
REQGADGET | BOOLGADGET, /* is a requestor, boolean */
NULL, /* BORDER descriptor */
NULL, /* SELECT descriptor */
&directtext[2], /* intiutext to write there */
0, /* mutual exclusion (could use) */
NULL, /* special info */
2, /* gadget identifier, user */
NULL }; /* user data pointer */
struct Gadget RightGadget = {
&UpGadget, /* address of next gadget */
60,25,45,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* Flags, complement select box */
RELVERIFY | GADGIMMEDIATE, /* Activation flags */
REQGADGET | BOOLGADGET, /* is a requestor, boolean */
NULL, /* BORDER descriptor */
NULL, /* SELECT descriptor */
&directtext[1], /* intiutext to write there */
0, /* mutual exclusion (could use) */
NULL, /* special info */
1, /* gadget identifier, user */
NULL }; /* user data pointer */
struct Gadget LeftGadget =
{
&RightGadget, /* next gadget */
20,25,34,10, /* left,top,width,height of hitbox */
GADGHCOMP, /* Flags, complement select box */
RELVERIFY | GADGIMMEDIATE, /* Activation flags */
REQGADGET | BOOLGADGET, /* Type ... is a requestor, boolean */
NULL, /* BORDER image */
NULL, /* SELECT image */
&directtext[0], /* intiutext to write there */
0, /* No mutual exclusion (could use) */
NULL, /* special info */
0, /* gadget identifier, user */
/* RETURNED IN code-field */
NULL }; /* no user data pointer */
struct Requester myrequest;
InitMyRequest()
{
InitRequester(&myrequest);
myrequest.LeftEdge = 10;
myrequest.TopEdge = 20;
myrequest.Width = 140;
myrequest.Height = 60;
myrequest.ReqGadget = &LeftGadget;
myrequest.ReqText = &movereqtext[0];
myrequest.BackFill = 1;
movereqtext[0].FrontPen = 0;
movereqtext[0].BackPen = 1;
movereqtext[0].DrawMode = JAM1;
movereqtext[0].ITextFont = &TestFont;
movereqtext[0].NextText = NULL;
movereqtext[0].LeftEdge = 5;
movereqtext[0].TopEdge = 1;
movereqtext[0].IText = (UBYTE *)"Move In-Frame:";
return(0);
}
InitMenu()
{
SHORT n,j,k;
menu[0].NextMenu = &menu[1];
menu[0].LeftEdge = 4; /* first menu at left edge */
menu[0].TopEdge = 0;
menu[0].Width = 44;
menu[0].Height = 10;
menu[0].Flags = MENUENABLED;
menu[0].MenuName = "Color";
menu[0].FirstItem = &coloritem[0];
menu[1].NextMenu = &menu[2];
menu[1].LeftEdge = 48;
menu[1].TopEdge = 0;
menu[1].Width = 40;
menu[1].Height = 10;
menu[1].Flags = MENUENABLED;
menu[1].MenuName = "Copy";
menu[1].FirstItem = ©item[0];
menu[2].NextMenu = &menu[3];
menu[2].LeftEdge = 88;
menu[2].TopEdge = 0;
menu[2].Width = 40;
menu[2].Height = 10;
menu[2].Flags = MENUENABLED;
menu[2].MenuName = "Move";
menu[2].FirstItem = &moveitem[0];
menu[3].NextMenu = &menu[4];
menu[3].LeftEdge = 128;
menu[3].TopEdge = 0;
menu[3].Width = 40;
menu[3].Height = 10;
menu[3].Flags = MENUENABLED;
menu[3].MenuName = "Text";
menu[3].FirstItem = &textitem[0];
menu[4].NextMenu = &menu[5];
menu[4].LeftEdge = 168;
menu[4].TopEdge = 0;
menu[4].Width = 40;
menu[4].Height = 10;
menu[4].Flags = MENUENABLED;
menu[4].MenuName = "Disk";
menu[4].FirstItem = &diskitem[0];
menu[5].NextMenu = NULL;
menu[5].LeftEdge = 208;
menu[5].TopEdge = 0;
menu[5].Width = 40;
menu[5].Height = 10;
menu[5].Flags = MENUENABLED;
menu[5].MenuName = "Misc";
menu[5].FirstItem = &miscitem[0];
n=0;
for(j=0; j<3; j++)
for(k=0; k<3; k++)
{
choiceitem[n].NextItem = &choiceitem[n+1];
choiceitem[n].LeftEdge = 100 + 30 * k;
choiceitem[n].TopEdge = -14 + (14 * j);
choiceitem[n].Width = 30;
choiceitem[n].Height = 14;
choiceitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
choiceitem[n].MutualExclude = 0;
choiceitem[n].ItemFill = (APTR)&choicetext[n];
choiceitem[n].SelectFill = NULL;
choiceitem[n].Command = 0;
choiceitem[n].SubItem = NULL;
choiceitem[n].NextSelect = 0;
n++;
}
choiceitem[8].NextItem = NULL;
n=0;
for(j=0; j<3; j++)
for(k=0; k<3; k++)
{
choiceitem2[n].NextItem = &choiceitem2[n+1];
choiceitem2[n].LeftEdge = 82 + 30 * k;
choiceitem2[n].TopEdge = -14 + (14 * j);
choiceitem2[n].Width = 30;
choiceitem2[n].Height = 14;
choiceitem2[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
choiceitem2[n].MutualExclude = 0;
choiceitem2[n].ItemFill = (APTR)&choicetext[n];
choiceitem2[n].SelectFill = NULL;
choiceitem2[n].Command = 0;
choiceitem2[n].SubItem = NULL;
choiceitem2[n].NextSelect = 0;
n++;
}
choiceitem2[8].NextItem = NULL;
for(n=0; n<2; n++)
{
diskitem[n].NextItem = &diskitem[n+1];
diskitem[n].LeftEdge = 0;
diskitem[n].TopEdge = 10 * n;
diskitem[n].Width = 56;
diskitem[n].Height = 10;
diskitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
diskitem[n].MutualExclude = 0;
diskitem[n].ItemFill = (APTR)&disktext[n];
diskitem[n].SelectFill = NULL;
diskitem[n].Command = 0;
diskitem[n].SubItem = NULL; /* there are no subitems on any */
diskitem[n].NextSelect = 0; /* not providing for drag select */
}
diskitem[1].NextItem = NULL;
for(n=0; n<4; n++)
{
copyitem[n].NextItem = ©item[n+1];
copyitem[n].LeftEdge = 0;
copyitem[n].TopEdge = 10 * n;
copyitem[n].Width = 112;
copyitem[n].Height = 10;
copyitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
copyitem[n].MutualExclude = 0;
copyitem[n].ItemFill = (APTR)©text[n];
copyitem[n].SelectFill = NULL;
copyitem[n].Command = 0;
copyitem[n].SubItem = NULL; /* there are no subitems on any */
copyitem[n].NextSelect = 0; /* not providing for drag select */
}
copyitem[3].NextItem = NULL;
copyitem[2].SubItem = &choiceitem2[0];
copyitem[3].SubItem = &choiceitem2[0];
for(n=0; n<3; n++)
{
moveitem[n].NextItem = &moveitem[n+1];
moveitem[n].LeftEdge = 0;
moveitem[n].TopEdge = 10 * n;
moveitem[n].Width = 88;
moveitem[n].Height = 10;
moveitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
moveitem[n].MutualExclude = 0;
moveitem[n].ItemFill = (APTR)&movetext[n];
moveitem[n].SelectFill = NULL;
moveitem[n].Command = 0;
moveitem[n].SubItem = NULL; /* there are no subitems on any */
moveitem[n].NextSelect = 0; /* not providing for drag select */
}
moveitem[2].NextItem = NULL;
moveitem[2].SubItem = &choiceitem2[0];
for(n=0; n<2; n++)
{
textitem[n].NextItem = &textitem[n+1];
textitem[n].LeftEdge = 0;
textitem[n].TopEdge = 10 * n;
textitem[n].Width = 100;
textitem[n].Height = 10;
textitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
textitem[n].MutualExclude = 0;
textitem[n].ItemFill = (APTR)&texttext[n];
textitem[n].SelectFill = NULL;
textitem[n].Command = 0;
textitem[n].NextSelect = 0; /* not providing for drag select */
}
textitem[1].NextItem = NULL;
/* textitem[0].SubItem = &jamitem[0];
textitem[1].SubItem = &topazitem[0];
*/
for(n=0; n<5; n++)
{
miscitem[n].NextItem = &miscitem[n+1];
miscitem[n].LeftEdge = -40;
miscitem[n].TopEdge = 10 * n;
miscitem[n].Width = 124;
miscitem[n].Height = 10;
miscitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
miscitem[n].MutualExclude = 0;
miscitem[n].ItemFill = (APTR)&misctext[n];
miscitem[n].SelectFill = NULL;
miscitem[n].Command = 0;
miscitem[n].SubItem = NULL; /* there are no subitems on any */
miscitem[n].NextSelect = 0; /* not providing for drag select */
}
miscitem[4].NextItem = NULL;
for(n=0; n<2; n++)
{
jamitem[n].NextItem = &jamitem[n+1];
jamitem[n].LeftEdge = 56;
jamitem[n].TopEdge = 10 * n;
jamitem[n].Width = 76;
jamitem[n].Height = 10;
jamitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
jamitem[n].MutualExclude = 0;
jamitem[n].ItemFill = (APTR)&jamtext[n];
jamitem[n].SelectFill = NULL;
jamitem[n].Command = 0;
jamitem[n].SubItem = NULL; /* there are no subitems on any */
jamitem[n].NextSelect = 0; /* not providing for drag select */
}
jamitem[1].NextItem = NULL;
for(n=0; n<2; n++)
{
topazitem[n].NextItem = &topazitem[n+1];
topazitem[n].LeftEdge = 56;
topazitem[n].TopEdge = 10 * n;
topazitem[n].Width = 76;
topazitem[n].Height = 10;
topazitem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHBOX ;
topazitem[n].MutualExclude = 0;
topazitem[n].ItemFill = (APTR)&topaztext[n];
topazitem[n].SelectFill = NULL;
topazitem[n].Command = 0;
topazitem[n].SubItem = NULL; /* there are no subitems on any */
topazitem[n].NextSelect = 0; /* not providing for drag select */
}
topazitem[1].NextItem = NULL;
InitColorItems(DEPTH);
InitCopyText();
InitMoveText();
InitTextText();
InitDiskText();
InitMiscText();
InitChoiceText();
InitJamText();
InitTopazText();
InitDirectText();
InitMyRequest();
return(0);
}
InitDirectText()
{
SHORT n;
for(n=0; n<5; n++)
{
directtext[n].FrontPen = 1;
directtext[n].BackPen = 0;
directtext[n].DrawMode = JAM2;
directtext[n].ITextFont = &TestFont;
directtext[n].NextText = NULL;
directtext[n].LeftEdge = 0;
directtext[n].TopEdge = 1;
}
directtext[0].IText = (UBYTE *)"Left";
directtext[1].IText = (UBYTE *)"Right";
directtext[2].IText = (UBYTE *)"Up";
directtext[3].IText = (UBYTE *)"Down";
directtext[4].IText = (UBYTE *)"EXIT";
return(0);
}
InitChoiceText()
{
SHORT n;
for(n=0; n<9; n++)
{
choicetext[n].FrontPen = 0;
choicetext[n].BackPen = 1;
choicetext[n].DrawMode = JAM2;
choicetext[n].LeftEdge = 8;
choicetext[n].TopEdge = 5;
choicetext[n].ITextFont = &TestFont;
choicetext[n].NextText = NULL;
}
choicetext[0].IText = (UBYTE *)"1";
choicetext[1].IText = (UBYTE *)"2";
choicetext[2].IText = (UBYTE *)"3";
choicetext[3].IText = (UBYTE *)"4";
choicetext[4].IText = (UBYTE *)"5";
choicetext[5].IText = (UBYTE *)"6";
choicetext[6].IText = (UBYTE *)"7";
choicetext[7].IText = (UBYTE *)"8";
choicetext[8].IText = (UBYTE *)"9";
return(0);
}
InitDiskText()
{
SHORT n;
for(n=0; n<2; n++)
{
disktext[n].FrontPen = 0;
disktext[n].BackPen = 1;
disktext[n].DrawMode = JAM2;
disktext[n].LeftEdge = 0;
disktext[n].TopEdge = 1;
disktext[n].ITextFont = &TestFont;
disktext[n].NextText = NULL;
}
disktext[0].IText = (UBYTE *)"Save";
disktext[1].IText = (UBYTE *)"Load";
return(0);
}
InitCopyText()
{
SHORT n;
for(n=0; n<4; n++)
{
copytext[n].FrontPen = 0;
copytext[n].BackPen = 1;
copytext[n].DrawMode = JAM2;
copytext[n].LeftEdge = 0;
copytext[n].TopEdge = 1;
copytext[n].ITextFont = &TestFont;
copytext[n].NextText = NULL;
}
copytext[0].IText = (UBYTE *)"Undo";
copytext[1].IText = (UBYTE *)"Snapshot";
copytext[2].IText = (UBYTE *)"From-Frame";
copytext[3].IText = (UBYTE *)"Merge-With";
return(0);
}
InitMoveText()
{
SHORT n;
for(n=0; n<3; n++)
{
movetext[n].FrontPen = 0;
movetext[n].BackPen = 1;
movetext[n].DrawMode = JAM2;
movetext[n].LeftEdge = 0;
movetext[n].TopEdge = 1;
movetext[n].ITextFont = &TestFont;
movetext[n].NextText = NULL;
}
movetext[0].IText = (UBYTE *)"Animate";
movetext[1].IText = (UBYTE *)"In-Frame";
movetext[2].IText = (UBYTE *)"Exchange";
return(0);
}
InitTextText()
{
SHORT n;
for(n=0; n<2; n++)
{
texttext[n].FrontPen = 0;
texttext[n].BackPen = 1;
texttext[n].DrawMode = JAM2;
texttext[n].LeftEdge = 0;
texttext[n].TopEdge = 1;
texttext[n].ITextFont = &TestFont;
texttext[n].NextText = NULL;
}
texttext[0].IText = (UBYTE *)"Into Frame";
texttext[1].IText = (UBYTE *)"Set Colors";
/* texttext[2].IText = "Color"; */
return(0);
}
InitMiscText()
{
SHORT n;
for(n=0; n<5; n++)
{
misctext[n].FrontPen = 0;
misctext[n].BackPen = 1;
misctext[n].DrawMode = JAM2;
misctext[n].LeftEdge = 0;
misctext[n].TopEdge = 1;
misctext[n].ITextFont = &TestFont;
misctext[n].NextText = NULL;
}
misctext[0].IText = (UBYTE *)" HELP! ";
misctext[1].IText = (UBYTE *)" Clear ";
misctext[2].IText = (UBYTE *)"ScrollViews";
misctext[3].IText = (UBYTE *)"Reconfigure";
misctext[4].IText = (UBYTE *)"Exit Program";
return(0);
}
InitJamText()
{
SHORT n;
for(n=0; n<2; n++)
{
jamtext[n].FrontPen = 0;
jamtext[n].BackPen = 1;
jamtext[n].DrawMode = JAM2;
jamtext[n].LeftEdge = 0;
jamtext[n].TopEdge = 1;
jamtext[n].ITextFont = &TestFont;
jamtext[n].NextText = NULL;
}
jamtext[0].IText = (UBYTE *)"JAM1";
jamtext[1].IText = (UBYTE *)"JAM2";
return(0);
}
InitTopazText()
{
SHORT n;
for(n=0; n<2; n++)
{
topaztext[n].FrontPen = 0;
topaztext[n].BackPen = 1;
topaztext[n].DrawMode = JAM2;
topaztext[n].LeftEdge = 0;
topaztext[n].TopEdge = 1;
topaztext[n].ITextFont = &TestFont;
topaztext[n].NextText = NULL;
}
topaztext[0].IText = (UBYTE *)"Topaz-60";
topaztext[1].IText = (UBYTE *)"Topaz-80";
return(0);
}